import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
import { DialogService } from '@shared/services/dialog.service';
import { UserInfoTemplateComponent } from '../user-info-template/user-info-template.component';

@Component({
  selector: 'app-user-list',
  templateUrl: './user-list.component.html',
  styleUrls: ['./user-list.component.css']
})
export class UserListComponent implements OnInit {
  validateForm: FormGroup;
  listOfData = [
    { username: '野蛮践踏', address: '刺骨利刃', race: '牛头人', profession: '战士' },
    { username: 'biubiubiu', address: '尘泥沼泽', race: '侏儒', profession: '法师' },
    { username: '无敌最俊朗', address: '刺骨利刃', race: '人类', profession: '圣骑士' },
  ];

  isVisible = false;

  constructor(private fb: FormBuilder, private dialogService: DialogService) {
    this.validateForm = this.fb.group({
      user: [null],
      address: [null]
    });
  }

  ngOnInit(): void {
  }

  upload(): void {
    this.dialogService.createComponentModal({
      title: '用户管理',
      component: UserInfoTemplateComponent,
      params: {
        data: '这是传入的参数'
      },
      callback: (data: any) => {
        console.warn(data);
      }
    });
  }

  download(): void {
    console.warn(123123);
  }

  showDialog(): void {
    this.isVisible = true;
  }

  handleCancel(): void {
    console.warn('弹窗取消按钮');
  }

  handleOk(): void {
    console.warn('弹窗确认按钮');
  }

  showPDF(): void {
    
  }

}
